package com.yztc.yidoutang.fragment.quanwuji_fragment;

import com.yztc.yidoutang.bean.QuanWuBean;
import com.yztc.yidoutang.bean.QuanWuListBean;

import java.util.HashMap;
import java.util.Map;

import rx.Subscriber;

/**
 * Created by My on 2016/10/20.
 */

public class QuanWuJiPresenter implements QuanWuJiContract.Presenter{
    private QuanWuJiContract.Model model;
    private QuanWuJiContract.View view;

    public QuanWuJiPresenter(QuanWuJiContract.View view) {
        this.view = view;
        this.model=new QuanWuJiModel();
    }

    @Override
    public void getQWJData(String queryWords) {
        Map<String,String> params=new HashMap<>();
        params.put("q",queryWords);
        params.put("last_group_id","0");
        model.getQWJData(params, new Subscriber<QuanWuBean>() {
            @Override
            public void onCompleted() {

            }

            @Override
            public void onError(Throwable e) {

            }

            @Override
            public void onNext(QuanWuBean quanWuBean) {
                view.GetQWJDataSuccess(quanWuBean.getData().getCases());
            }
        });
    }
}
